function addScmUser() {
    Ajax.getHtml('user/userAdd.html', function (html) {
        layer.open({
            type: 1,
            title: '新增用户',
            area: ['600px'],
            content: html,
            btn: ['确认', '取消'],
            yes: function () {
                saveUser()
            },
            btn2: function () {
                console.log('取消新增用户')
            }
        })
    })
}

function saveUser() {
    var modelNames=[]
    var i=0
    $('input[type=checkbox][name="modelName"]:checked').each(function () {
        modelNames[i]=$(this).val();
        i++;
    })
    Ajax.post(
        '/addScmUser',
        {
            account: $('#accountname').val(),
            password: $('#password').val(),
            username:$('#Uname').val(),
            status:$('input[type=radio][name=status]:checked').val(),
            modelNames:modelNames.join()
        },
        function (result) {
            doResult(result, function () {
                layer.closeAll()
                show('user/scmUserList.html')
                layer.alert(result.msg)
            })
        }
    )
}
function updateUser() {
    var modelNames=[]
    var i=0
    $('input[type=checkbox][name="modelName"]:checked').each(function () {
        modelNames[i]=$(this).val();
        i++;
    })
    Ajax.post(
        '/updateScmUser',
        {
            account: $('#accountname').val(),
            password: $('#password').val(),
            username:$('#Uname').val(),
            status:$('input[type=radio][name=status]:checked').val(),
            modelNames:modelNames.join()
        },
        function (result) {
            doResult(result, function () {
                layer.closeAll()
                show('user/scmUserList.html')
                layer.alert(result.msg)
            })
        }
    )
}
